@import '../../styles/global.less';
.k-image {
  position: relative;
  display: inline-block;
  text-align: center;
  line-height: 1;
  .k-image-img {
    width: 100%;
    height: auto;
    // max-height: 100%;
  }
  .k-image-loading {
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    right: 0;
    background-color: @mask-color;
    display: flex;
    color: @border-color;
    align-items: center;
    justify-content: center;
  }
  .k-image-error {
    font-size: 50px;
    opacity: .3;
    color: @border-color;
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translateX(-50%) translateY(-50%);
  }
}

.k-image-preview {
  // transition: all .25s ease-in-out;
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 1001;
  .k-image-preview-mask {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 1001;
    height: 100%;
    background-color: @mask-color;
  }
  .k-image-preview-wrap {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    overflow: hidden;
    outline: 0;
    -webkit-overflow-scrolling: touch;
    z-index: 1002;
    pointer-events: none;
    .k-image-preview-control {
      background-color: fade(@mask-color, 20%);
      display: flex;
      width: 100%;
      position: absolute;
      pointer-events: auto;
      bottom: 0;
      left: 0;
      z-index: 1;
      flex-direction: row-reverse;
      list-style: none;
      align-items: center;
      justify-content: center;
      path {
        stroke-width: 40px !important;
      }
      .k-image-preview-action {
        margin: 12px;
        color: @border-color;
        font-size: 28px;
        cursor: pointer;
        list-style: none;
        width: 40px;
        height: 40px;
        display: flex;
        align-items: center;
        justify-content: center;
        border-radius: 50%;
        &:hover {
          background-color: fade(@mask-color, 30%);
        }
      }
      .k-image-preview-action-rotate-left {
        transform: rotateY(-180deg) rotate(45deg);
      }
      .k-image-preview-action-rotate-right {
        transform: rotate(45deg);
      }
      .k-image-preview-action-disabled {
        opacity: .6;
        cursor: not-allowed;
      }
    }
    .k-image-preview-switch-left, .k-image-preview-switch-right {
      position: absolute;
      width: 44px;
      height: 44px;
      color: @border-color;
      font-size: 25px;
      border-radius: 50%;
      background-color: fade(@mask-color, 30%);
      display: flex;
      align-items: center;
      justify-content: center;
      z-index: 1;
      top: 50%;
      pointer-events: auto;
      cursor: pointer;
      &:hover {
        background-color: @main;
      }
    }
    .k-image-preview-switch-left {
      left: 10px;
    }
    .k-image-preview-switch-right {
      right: 10px;
    }
    .k-image-preview-switch-disabled {
      cursor: not-allowed;
      opacity: .3;
      &:hover {
        background-color: fade(@mask-color, 30%);
      }
    }
    .k-image-preview-img-wrap {
      position: absolute;
      top: 0;
      right: 0;
      bottom: 0;
      left: 0;
      transition: transform .3s cubic-bezier(.215, .61, .355, 1) 0s;
      text-align: center;
      overflow: hidden;
      pointer-events: none;
      &::before {
        display: inline-block;
        width: 0;
        height: 50%;
        content: '';
      }
      .k-image-preview-img {
        vertical-align: middle;
        user-select: none;
        pointer-events: auto;
        cursor: grab;
        transition: transform .3s ease-in-out;
        max-width: 100%;
        max-height: 100%;
      }
    }
  }
}

.k-image-group {
  display: inline-block;
}

@keyframes k-image-zoom-in {
  from {
    opacity: 0;
    transform: scale3d(.3, .3, 0) translateZ(0);
  }
  to {
    opacity: 1;
  }
}

@keyframes k-image-zoom-out {
  from {
    opacity: 1;
  }
  to {
    opacity: 0;
    transform: scale3d(.3, .3, 0) translateZ(0);
  }
}

.k-image-zoom-enter-active {
  animation: k-image-zoom-in .25s cubic-bezier(.78, .14, .15, .86);
}

.k-image-zoom-leave-active {
  animation: k-image-zoom-out .25s cubic-bezier(.78, .14, .15, .86);
}

.k-image-preview-loading {
  color: @border-color;
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 1;
  width: 50px;
  font-size: 20px;
  height: 50px;
  border-radius: 10px;
  background: fade(@mask-color, 10%);
  display: flex;
  align-items: center;
  justify-content: center;
}